<?php if (!defined('THINK_PATH')) exit();?><html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> 
  <meta name="format-detection" content="telephone=no">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <link rel="stylesheet" type="text/css" href="/Public/css/index.css">
  <script type="text/javascript" src="/Public/js/jquery-1.11.3.min.js"></script>
</script> 
  <title>私宠订制--添加信息</title>
</head>
<body>
<div class="addinfo_all">
  <div class="addinfo_top">
    <img src="/Public/img/logo.png" width="40px" /><div class="fontinfo_add">信息添加</div>
  </div>
  <div class="info_gn_add">
    <div class="info_left">宠物名字:</div><div class="info_right"><input type="text" value="<?php echo ($info["petname"]); ?>" class="petname" placeholder="宠物の名字" /></div>
  </div>

  <div class="clear"></div>

  <div class="info_gn_add">
    <div class="info_left">宠物年龄:</div><div class="info_right">
    <select name="year" id="year" class="gn_add">
      <option value="0">年龄</option>
      <option value="0">0年</option>
      <option value="1">1年</option>
      <option value="2">2年</option>
      <option value="3">3年</option>
      <option value="4">4年</option>
      <option value="5">5年</option>
      <option value="6">6年</option>
      <option value="7">7年</option>
      <option value="8">8年</option>
      <option value="9">9年</option>
      <option value="10">10年</option>
      <option value="11">11年</option>
      <option value="12">12年</option>
      <option value="13">13年</option>
      <option value="14">14年</option>
      <option value="15">15年</option>
      <option value="16">16年</option>
      <option value="17">17年</option>
      <option value="18">18年</option>

    </select>
    零
    <select name="mous" id="mous" class="gn_add">
      <option value="0">月龄</option>
      <option value="0">0个月</option>
      <option value="1">1个月</option>
      <option value="2">2个月</option>
      <option value="3">3个月</option>
      <option value="4">4个月</option>
      <option value="5">5个月</option>
      <option value="6">6个月</option>
      <option value="7">7个月</option>
      <option value="8">8个月</option>
      <option value="9">9个月</option>
      <option value="10">10个月</option>
      <option value="11">11个月</option>
      <option value="12">12个月</option>
    </select>
    零
    <select name="day" id="day" class="gn_add">
      <option value="0">日龄</option>
      <option value="0">0天</option>
      <option value="1">1天</option>
      <option value="2">2天</option>
      <option value="3">3天</option>
      <option value="4">4天</option>
      <option value="5">5天</option>
      <option value="6">6天</option>
      <option value="7">7天</option>
      <option value="8">8天</option>
      <option value="9">9天</option>
      <option value="10">10天</option>
      <option value="11">11天</option>
      <option value="12">12天</option>
      <option value="13">13天</option>
      <option value="14">14天</option>
      <option value="15">15天</option>
      <option value="16">16天</option>
      <option value="17">17天</option>
      <option value="18">18天</option>
      <option value="19">19天</option>
      <option value="20">20天</option>
      <option value="21">21天</option>
      <option value="22">22天</option>
      <option value="23">23天</option>
      <option value="24">24天</option>
      <option value="25">25天</option>
      <option value="26">26天</option>
      <option value="27">27天</option>
      <option value="28">28天</option>
      <option value="29">29天</option>
      <option value="30">30天</option>
      <option value="31">31天</option>
    </select></div>
  </div>
<div class="clear"></div>
<div class="info_gn_add">
    <div class="info_left">宠物类型:</div>
    <div class="info_right">
      <select class="petclass">
        <option value="0">选择宠物种类</option>
        <option value="1">狗狗</option>
        <option value="2">猫咪</option>
        <option value="3">兔子</option>
        <option value="4">老鼠</option>
        <option value="5">其他</option>
      </select>
    </div>
  </div>
<select class="month type-link value_info  anmimo-type2" disabled>
<option value="0">选择宠物类型</option>
</select>
  <div class="clear"></div>

<div class=" info_left_new">
    <div class="info_left ">主人电话:</div><div class="info_right"><input value="<?php echo ($info["tel"]); ?>" type="text" placeholder="主人の电话" class="tel"/></div>
  </div>
  <br/><br/>
  <div class=" info_left_new">
    <div class="info_left">主人QQ:</div><div class="info_right"><input type="text" value="<?php echo ($info["qq"]); ?>" placeholder="主人のQQ" class="qq"/></div>
  </div>
  <br/><br/>
 <div class=" info_left_new">
    <div class="info_left">主人微信:</div><div class="info_right"><input type="text" value="<?php echo ($info["vx"]); ?>" placeholder="主人の微信" class="wx"/></div>
  </div>
  <br/><br/>
   
     <div class="clear"></div>
  <div class="info_left_new">
    <div class="info_left">服务区域:</div> 
      <select id="sysProvince" name="sysProvince" >
          <option value="">选择省份</option>
        </select>
      <select id="sysCity" name="sysCity" >
       <option value="">选择城市</option>
       </select> 
      <select id="sysArea" name="sysArea" >
       <option value="">选择区域</option>
    </select>  
  </div>


  <div class="clear"></div>
  <div class="info_left_new">
    <div class="info_left">服务店铺:</div><div class="info_right"><input type="text" value="<?php echo ($info["shopname"]); ?>" placeholder="宠物店(医院)的名字" class="shop_name"/></div>
  </div>
   
    <div class="clear"></div>
  <div class="info_left_new">
    <div class="info_left">店铺电话:</div><div class="info_right"><input type="text" placeholder="免费咨询店铺电话" class="shop_tel"/></div>
  </div>
  <!--  <br/><br/>
  <div class="info_gn_add info_left_new">
    <div class="info_left">填写秘钥:</div><div class="info_right"><input type="text" placeholder="填写秘钥,向购买者询问" class="key"/></div>
  </div> -->
   <div class="clear"></div>
  <div class="submit">提交信息</div>

</div>

<script type="text/javascript">
  //选择宠物的种类之后
            $('.petclass').change(function(){
            $('.anmimo-type2').show();
            var val=$(this).find('option:selected').val();
            $.getJSON("/Public/json/petclass.json",function(data){  
            var strHtmlC = "";//存储数据的变量   
            strHtmlC+='<option value="">'+'选择宠物类型'+'</option>';
            $.each(data,function(infoIndex,info){
              if(info['p_t_status']==val){
                strHtmlC+='<option value="'+info['p_t_id']+'">'+info['p_t_name']+'</option>';
              }
            }) 
            $('.anmimo-type2').empty();
            $('.anmimo-type2').append(strHtmlC);
            $('.anmimo-type2').attr('disabled',false);
            $('.anmimo-type2').css('background-color','#FFFFFF');
            })
          })
</script>

<script>
  $('.submit').on('click',function(){
  var petname=$('.info_right input').val();
  var ye=$('#year').val();
  var mo=$('#mous').val();
  var da=$('#day').val();
  var pettype=$('.petclass').val();
  var petclass=$('.value_info').val();
  var tel=$('.tel').val();
  var qq=$('.qq').val();
  var wx=$('.wx').val();
  var shopname=$('.shop_name').val();
  var key=$('.key').val();
  var shop_tel=$('.shop_tel').val();
  var pr=$('#sysProvince').val();
  var ci=$('#sysCity').val();
  var ar=$('#sysArea').val();
var myreg = /^(((13[0-9]{1})|(17[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/; 
if(!myreg.test($(".tel").val())) 
{ 
    alert('请输入有效的手机号码！'); 
    return false; 
}
  $.post("<?php echo U('Index/in_gongnengadd');?>",{pr:pr,ci:ci,ar:ar,petname:petname,ye:ye,mo:mo,da:da,pettype:pettype,petclass:petclass,tel:tel,qq:qq,wx:wx,shopname:shopname,key:key,shop_tel:shop_tel},function(data){
    if(data.status==100){
      var val=data.info;
      alert('保存成功,将要跳转到首页');
      location.href="<?php echo U('Index/index');?>";
    }else if(data.status==101){
      alert('保存失败');
    }else{
      alert('手机秘钥错误,请向官方索要!');
    }
  })
  })

</script>

<script type="text/javascript">
  $(function(){ 
    $.getJSON("/Public/json/areas.json",function(data){  
    var strHtml = "";//存储数据的变量  
    $.each(data,function(infoIndex,info){ 
      if(info['level']==1){
        strHtml+='<option value="'+info['id']+'">'+info['area_name']+'</option>';
      }
    }) 
    $('#sysProvince').append(strHtml);//显示处理后的数据 
    }) 
    })

  $('#sysProvince').change(function(){
            var id=$(this).val();
             $.getJSON("/Public/json/areas.json",function(data){  
             var strHtmlcity = "";//存储数据的变量  
             $.each(data,function(infoIndex,info){ 
              if(info['pid']==id){
                strHtmlcity+='<option value="'+info['id']+'">'+info['area_name']+'</option>';
              }
            }) 
            $('#sysCity').empty();
            $('#sysCity').append('<option>选择城市</option>');
            $('#sysArea').empty();
            $('#sysArea').append('<option>选择区域</option>');
            $('#sysCity').append(strHtmlcity);//显示处理后的数据 
            }) 
       })

$("#sysCity").on('change',function(){
   var id=$(this).val();
   $.getJSON("/Public/json/areas.json",function(data){  
   var strHtmlsysArea = "";//存储数据的变量  
   $.each(data,function(infoIndex,info){ 
    if(info['pid']==id){
      strHtmlsysArea+='<option value="'+info['id']+'">'+info['area_name']+'</option>';
    }
  }) 
  $('#sysArea').empty();
  $('#sysArea').append('<option>选择区域</option>');
  $('#sysArea').append(strHtmlsysArea);//显示处理后的数据 
  }) 
}); 
</script>
</body>
</html>